﻿Public Class FormatosGrid
    Public Class funciones
        Public Shared Sub formatoGrid_Roles(ByVal grid As DataGridView, ByVal tabla As DataTable)
            'Propiedades del grid
            With grid
                .DataSource = tabla
                .SelectionMode = DataGridViewSelectionMode.FullRowSelect
                .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
                .AllowUserToAddRows = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = False

                .ReadOnly = True
                'Definicion de titulos de Columnas
                .Columns(0).HeaderText = "CODIGO"
                .Columns(1).HeaderText = "ROLES"
                'Definicion de Ancho de Columnas
                .Columns(0).Width = 30
                .Columns(1).Width = 370
                'Definicion de la Alineacion de los titulos de Columnas
                .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
            'formato de presentacion
            Dim i As Integer

            For i = 0 To tabla.Rows.Count - 1
                If (i Mod 2 = 0) Then
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
                Else
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
                End If
            Next
            'rotulos de columnas en mayusculas
            For i = 0 To tabla.Columns.Count - 1
                grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
                grid.Columns(i).DefaultCellStyle.Alignment =
                    DataGridViewContentAlignment.MiddleCenter
            Next
        End Sub
        Public Shared Sub formatoGrid_Usuarios(ByVal grid As DataGridView, ByVal tabla As DataTable)
            'Propiedades del grid
            With grid
                .DataSource = tabla
                .SelectionMode = DataGridViewSelectionMode.FullRowSelect
                .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
                .AllowUserToAddRows = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = False
                .ReadOnly = True
                'Definicion de titulos de Columnas
                .Columns(0).HeaderText = "CODIGO"
                .Columns(1).HeaderText = "USUARIO"
                .Columns(2).HeaderText = "CONTRASEÑA"
                .Columns(3).HeaderText = "ROL"
                .Columns(4).Visible = False
                'Definicion de Ancho de Columnas
                .Columns(0).Width = 100
                .Columns(1).Width = 270
                .Columns(2).Width = 270
                .Columns(3).Width = 270
                'Definicion de la Alineacion de los titulos de Columnas
                .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
            'formato de presentacion
            Dim i As Integer

            For i = 0 To tabla.Rows.Count - 1
                If (i Mod 2 = 0) Then
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
                Else
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
                End If
            Next
            'rotulos de columnas en mayusculas
            For i = 0 To tabla.Columns.Count - 1
                grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
                grid.Columns(i).DefaultCellStyle.Alignment =
                    DataGridViewContentAlignment.MiddleCenter
            Next
        End Sub
        Public Shared Sub formatoGrid_Items(ByVal grid As DataGridView, ByVal tabla As DataTable)
            'Propiedades del grid
            With grid
                .DataSource = tabla
                .SelectionMode = DataGridViewSelectionMode.FullRowSelect
                .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
                .AllowUserToAddRows = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = False
                .ReadOnly = True
                'Definicion de titulos de Columnas
                .Columns(0).HeaderText = "CODIGO"
                .Columns(1).HeaderText = "NOMBRE"
                .Columns(2).HeaderText = "ORIGEN"
                .Columns(3).HeaderText = "PRESENTACION"
                .Columns(4).HeaderText = "PESO"
                .Columns(5).HeaderText = "TALLA"
                .Columns(6).HeaderText = "COSTO"
                .Columns(7).HeaderText = "TIPO"
                .Columns(8).Visible = False
                'Definicion de Ancho de Columnas
                .Columns(0).Width = 40
                .Columns(1).Width = 100
                .Columns(2).Width = 100
                .Columns(3).Width = 100
                .Columns(4).Width = 100
                .Columns(5).Width = 100
                .Columns(6).Width = 100
                .Columns(7).Width = 100
                'Definicion de la Alineacion de los titulos de Columnas
                .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
            'formato de presentacion
            Dim i As Integer

            For i = 0 To tabla.Rows.Count - 1
                If (i Mod 2 = 0) Then
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
                Else
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
                End If
            Next
            'rotulos de columnas en mayusculas
            For i = 0 To tabla.Columns.Count - 1
                grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
                grid.Columns(i).DefaultCellStyle.Alignment =
                    DataGridViewContentAlignment.MiddleCenter
            Next
        End Sub
        Public Shared Sub formatoGrid_Bodegas(ByVal grid As DataGridView, ByVal tabla As DataTable)
            'Propiedades del grid
            With grid
                .DataSource = tabla
                .SelectionMode = DataGridViewSelectionMode.FullRowSelect
                .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
                .AllowUserToAddRows = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = False
                .ReadOnly = True
                'Definicion de titulos de Columnas
                .Columns(0).HeaderText = "CODIGO"
                .Columns(1).HeaderText = "NOMBRE"
                .Columns(2).HeaderText = "TIPO"
                .Columns(3).Visible = False
                'Definicion de Ancho de Columnas
                .Columns(0).Width = 100
                .Columns(1).Width = 270
                .Columns(2).Width = 270
                .Columns(3).Width = 270
                'Definicion de la Alineacion de los titulos de Columnas
                .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
            'formato de presentacion
            Dim i As Integer

            For i = 0 To tabla.Rows.Count - 1
                If (i Mod 2 = 0) Then
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
                Else
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
                End If
            Next
            'rotulos de columnas en mayusculas
            For i = 0 To tabla.Columns.Count - 1
                grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
                grid.Columns(i).DefaultCellStyle.Alignment =
                    DataGridViewContentAlignment.MiddleCenter
            Next
        End Sub
        Public Shared Sub formatoGrid_Socios(ByVal grid As DataGridView, ByVal tabla As DataTable)
            'Propiedades del grid
            With grid
                .DataSource = tabla
                .SelectionMode = DataGridViewSelectionMode.FullRowSelect
                .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
                .AllowUserToAddRows = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = False
                .ReadOnly = True
                'Definicion de titulos de Columnas
                .Columns(1).HeaderText = "CODIGO"
                .Columns(2).HeaderText = "NOMBRE"
                .Columns(3).HeaderText = "DIRECCION"
                .Columns(4).HeaderText = "IDENTIFICACION"
                .Columns(5).HeaderText = "TELEFONO"
                .Columns(6).HeaderText = "E-MAIL"
                .Columns(7).HeaderText = "CONTACTO"
                .Columns(8).HeaderText = "TIPO"
                .Columns(0).Visible = False
                .Columns(9).Visible = False
                'Definicion de Ancho de Columnas

                .Columns(1).Width = 50
                .Columns(2).Width = 200
                .Columns(3).Width = 100
                .Columns(4).Width = 100
                .Columns(5).Width = 100
                .Columns(6).Width = 100
                .Columns(7).Width = 100
                .Columns(8).Width = 100
                'Definicion de la Alineacion de los titulos de Columnas
                .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
            'formato de presentacion
            Dim i As Integer

            For i = 0 To tabla.Rows.Count - 1
                If (i Mod 2 = 0) Then
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
                Else
                    grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
                End If
            Next
            'rotulos de columnas en mayusculas
            For i = 0 To tabla.Columns.Count - 1
                grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
                grid.Columns(i).DefaultCellStyle.Alignment =
                    DataGridViewContentAlignment.MiddleCenter
            Next
        End Sub
    End Class
    Public Shared Sub formatoGrid_Movimientos(ByVal grid As DataGridView, ByVal tabla As DataTable)
        'Propiedades del grid
        With grid
            .DataSource = tabla
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
            .AllowUserToAddRows = False
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            .AllowUserToDeleteRows = False
            .AllowUserToOrderColumns = False
            .ReadOnly = True
            'Definicion de titulos de Columnas
            .Columns(0).Visible = False
            .Columns(1).HeaderText = "CODIGO"
            .Columns(2).HeaderText = "FECHA"
            .Columns(3).HeaderText = "DESCRIPCION"
            .Columns(4).Visible = False
            .Columns(5).Visible = False
            .Columns(6).Visible = False
            'Definicion de Ancho de Columnas
            .Columns(1).Width = 100
            .Columns(2).Width = 270
            .Columns(3).Width = 270

            'Definicion de la Alineacion de los titulos de Columnas
            .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter

        End With
        'formato de presentacion
        Dim i As Integer

        For i = 0 To tabla.Rows.Count - 1
            If (i Mod 2 = 0) Then
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
            Else
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
            End If
        Next
        'rotulos de columnas en mayusculas
        For i = 0 To tabla.Columns.Count - 1
            grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
            grid.Columns(i).DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter
        Next
    End Sub
    Public Shared Sub formatoGrid_Movimientos_Detalles(ByVal grid As DataGridView, ByVal tabla As DataTable)
        'Propiedades del grid
        With grid
            .DataSource = tabla
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
            .AllowUserToAddRows = False
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            .AllowUserToDeleteRows = False
            .AllowUserToOrderColumns = False
            .ReadOnly = True
            'Definicion de titulos de Columnas
            .Columns(0).Visible = False
            .Columns(1).HeaderText = "PRODUCTO"
            .Columns(2).HeaderText = "PRESENTACION"
            .Columns(3).HeaderText = "TALLA"
            .Columns(4).HeaderText = "CANTIDAD (LBS)"

            'Definicion de Ancho de Columnas
            .Columns(1).Width = 150
            .Columns(2).Width = 150
            .Columns(3).Width = 150
            .Columns(4).Width = 150

            'Definicion de la Alineacion de los titulos de Columnas

            .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter

        End With
        'formato de presentacion
        Dim i As Integer

        For i = 0 To tabla.Rows.Count - 1
            If (i Mod 2 = 0) Then
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
            Else
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
            End If
        Next
        'rotulos de columnas en mayusculas
        For i = 0 To tabla.Columns.Count - 1
            grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
            grid.Columns(i).DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter
        Next
    End Sub
    Public Shared Sub formatoGrid_Filtrar_Productos(ByVal grid As DataGridView, ByVal tabla As DataTable)
        'Propiedades del grid
        With grid
            .DataSource = tabla
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
            .AllowUserToAddRows = False
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            .AllowUserToDeleteRows = False
            .AllowUserToOrderColumns = False
            .ReadOnly = True
            'Definicion de titulos de Columnas
            .Columns(0).HeaderText = "CODIGO"
            .Columns(1).HeaderText = "PRODUCTO"
 

            'Definicion de Ancho de Columnas
            .Columns(0).Width = 100
            .Columns(1).Width = 270

            'Definicion de la Alineacion de los titulos de Columnas

            .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter


        End With
        'formato de presentacion
        Dim i As Integer

        For i = 0 To tabla.Rows.Count - 1
            If (i Mod 2 = 0) Then
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
            Else
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
            End If
        Next
        'rotulos de columnas en mayusculas
        For i = 0 To tabla.Columns.Count - 1
            grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
            grid.Columns(i).DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter
        Next
    End Sub
    Public Shared Sub formatoGrid_Mostrar_Inventario(ByVal grid As DataGridView, ByVal tabla As DataTable)
        'Propiedades del grid
        With grid
            .DataSource = tabla
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
            .AllowUserToAddRows = False
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            .AllowUserToDeleteRows = False
            .AllowUserToOrderColumns = False
            .ReadOnly = True
            'Definicion de titulos de Columnas
            .Columns(0).Visible = False
            .Columns(1).HeaderText = "PRODUCTO"
            .Columns(2).HeaderText = "CANTIDAD (LBS)"


            'Definicion de Ancho de Columnas
            .Columns(1).Width = 270
            .Columns(2).Width = 270

            'Definicion de la Alineacion de los titulos de Columnas

            .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter


        End With
        'formato de presentacion
        Dim i As Integer

        For i = 0 To tabla.Rows.Count - 1
            If (i Mod 2 = 0) Then
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
            Else
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
            End If
        Next
        'rotulos de columnas en mayusculas
        For i = 0 To tabla.Columns.Count - 1
            grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
            grid.Columns(i).DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter
        Next
    End Sub
    Public Shared Sub formatoGrid_Mostrar_Movimiento(ByVal grid As DataGridView, ByVal tabla As DataTable)
        'Propiedades del grid
        With grid
            .DataSource = tabla
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
            .AllowUserToAddRows = False
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            .AllowUserToDeleteRows = False
            .AllowUserToOrderColumns = False
            .ReadOnly = True
            'Definicion de titulos de Columnas
            '.Columns(0).Visible = False
            .Columns(0).HeaderText = "PRODUCTO"
            .Columns(1).HeaderText = "CANTIDAD (LBS)"


            'Definicion de Ancho de Columnas
            .Columns(0).Width = 270
            .Columns(1).Width = 270

            'Definicion de la Alineacion de los titulos de Columnas

            .Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            .Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter


        End With
        'formato de presentacion
        Dim i As Integer

        For i = 0 To tabla.Rows.Count - 1
            If (i Mod 2 = 0) Then
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AliceBlue
            Else
                grid.Rows(i).DefaultCellStyle.BackColor = Color.AntiqueWhite
            End If
        Next
        'rotulos de columnas en mayusculas
        For i = 0 To tabla.Columns.Count - 1
            grid.Columns(i).HeaderText = grid.Columns(i).HeaderText.ToUpper
            grid.Columns(i).DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter
        Next
    End Sub
End Class
